<?php
namespace app\wechat\controller;

use WeChatSdk\Factory;

use think\Config;
//use think\Env;
class Index extends Common
{
    public function index()
    {
        $config = config("wechat.official_account");
        $app = Factory::officialAccount($config);
var_dump($app);exit;
        $app->server->push(function ($message) {
            file_put_contents("/var/log/wechat.log", json_encode($message));
            return "您好！欢迎使用 EasyWeChat";
        });

        $response = $app->server->serve();

        // 将响应输出
        $response->send();exit;
    }

}
